<?php 

   class wap extends Model
	{
			//设置全局变量
		public function getSet(){
			$this->dsql->SetQuery('select * from `#@__atwap`');
			$this->dsql->Execute();
			return $this->dsql->GetArray();

		}

			//栏目信息
		public function getType(){
			$this->dsql->SetQuery('select * from `#@__atwap_type');
			$this->dsql->Execute();
			while( $row = $this->dsql->GetArray() ) {
				$atwap_type[] = $row;
			}
			return $atwap_type;
		}



			//获取文章列表模型
		public function getArclist($typeid=0,$num=1,$order='pubdate'){
			if(!$typeid){
				//获取整站列表
				$this->dsql->SetQuery("select * from `#@__archives` where `arcrank`=0 limit='$num' order by='$order'");
				@$this->dsql->Execute();
				while($row = $this->dsql->GetArray()){
					$getArclist[] = $row;
				}

			}else{
				foreach($GLOBALS['atwap']['waptype'] as $value){
					if($value['typeid']==$typeid){
							$catid =  $value['cat'];
							$this->dsql->SetQuery("select * from `#@__archives` where `typeid`='$catid' and `arcrank`=0 order by '$order' limit $num");
							@$this->dsql->Execute();
							while($row = $this->dsql->GetArray()){
								$getArclist[] = $row;
							}
							break;
					}
				}
			}
			return $getArclist;
		}




			//获取单篇文章内容
		public function getArticle($aid=1){
			$this->dsql->SetQuery("SELECT * FROM `#@__archives` AS a, `#@__addonarticle` AS b WHERE a.id = b.aid and a.arcrank=0 and a.id='$aid'");
			@$this->dsql->Execute();
			return $this->dsql->GetArray();
		}


	}
?>